package com.sand.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sand.entity.user.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    //根据数据库名称获取数据库中的所有表名
    @Select("SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = #{databaseName} ")
    List<String> listTables(String databaseName);

    //根据表名获取总条数
    @Select("SELECT COUNT(*) FROM ${tableName}")
    long countTable(@Param("tableName") String tableName);

}
